package com.huawen.cms.app.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.PostConstruct;
import java.util.Map;

public class WebBaseController {

	@Autowired
	private freemarker.template.Configuration configuration;

	private String ctx = "localhost:8081/";

	// Spring 初始化的时候加载配置
	@PostConstruct
	public void setConfigure() throws Exception {

		// 加载html的资源路径
		configuration.setSharedVariable("ctx", ctx);
	}

	@RequestMapping("/ctx")
	@ResponseBody
	public String ctx() {
		return ctx;
	}

}
